import logging
import os



def w_log():
    path = os.getcwd()
    file_name = 'back.log'
    file = os.path.join(path,file_name)
    if os.path.exists(file) :
        mode = 'a'
    else :
        mode = 'w'
    format = '%(asctime)s %(filename)s[line:%(lineno)d] %(levelname)s %(message)s'
    logging.basicConfig(level=logging.DEBUG,format=format,filename=file,filemode=mode)
    return logging


if __name__ =='__main__' :
    r_log = w_log()
    r_log.info('ahhha')
    r_log.error('dajiji')